package day03;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/10
 */
public class NiceNumber {
    public static void main(String[] args) {
        System.out.println("50000以内的完备数如下：");

        for (int num = 1; num <= 50000; num++) {
            int sum = 0;
            // 找约数并求和
            for (int j = 1; j < num; j++) {
                if (num % j == 0){
                    sum += j;
                }
            }
            // 判断是否为完备数
            if (sum == num){
                System.out.println(num);
            }
        }
    }
}
